/****************************************************************************
*                                                                           *
* settingstabs.cpp									                        *
*                                                                           *
* ALaRI 2008												                *
*                                                                           *
****************************************************************************/ 

/****************************************************************************
* Includes                                                                  *
****************************************************************************/ 
#include "settingstabs.h"

#include <QGroupBox>
#include <QLabel>
#include <QDoubleSpinBox>
#include <QSpinBox>
#include <QGridLayout>
#include <QVBoxLayout>

CSimulationTab::CSimulationTab(CSimProperty *pQObjAppProp,  QWidget *pParent)
	: QWidget(pParent)
{
	QGroupBox *pQGroupBoxSimulator = new QGroupBox(tr("Simulator"));
	QLabel *pQLabelFreq = new QLabel(tr("Frequency,(GHz):"));

	QDoubleSpinBox *pQDoubleSpinBoxFreq = new QDoubleSpinBox();
	// TODO : we do not allow now to change this value
	pQDoubleSpinBoxFreq->setEnabled(false);
	pQDoubleSpinBoxFreq->setRange(0.5f, 5.0f);
	m_dblFreq = pQObjAppProp->getFrequency();
	pQDoubleSpinBoxFreq->setValue(m_dblFreq);
	connect(pQDoubleSpinBoxFreq, SIGNAL(valueChanged(double)), SLOT(setFrequency(double)));  

	QLabel *pQLabelRes = new QLabel(tr("Resolution, (cm):"));
	QSpinBox *pSpinBoxRes = new QSpinBox();
	// TODO : we do not allow now to change this value
	pSpinBoxRes->setEnabled(false);
	pSpinBoxRes->setRange(1, 10);
	m_nResolution = pQObjAppProp->getResolution();
	pSpinBoxRes->setValue(m_nResolution);
	connect(pSpinBoxRes, SIGNAL(valueChanged(int)), SLOT(setResolution(int)));  

	QGridLayout *pQGridLayoutSim = new QGridLayout();
	pQGridLayoutSim->addWidget(pQLabelFreq, 0, 0);
	pQGridLayoutSim->addWidget(pQDoubleSpinBoxFreq, 0, 2);
	pQGridLayoutSim->addWidget(pQLabelRes, 1, 0);
	pQGridLayoutSim->addWidget(pSpinBoxRes, 1, 2);

	pQGroupBoxSimulator->setLayout(pQGridLayoutSim);

	QVBoxLayout *pQVBoxLayoutMain = new QVBoxLayout();
	pQVBoxLayoutMain->addWidget(pQGroupBoxSimulator);
	setLayout(pQVBoxLayoutMain);
}

CSensorTab::CSensorTab(CSimProperty *pQObjAppProp,  QWidget *pParent)
	: QWidget(pParent) 
{
	QGroupBox *pQGroupBoxTransceiver = new QGroupBox(tr("Transceiver"));
	QLabel *pQLabelOutputPower = new QLabel(tr("Output power, (dBm):"));
	QSpinBox *pQSpinBoxOutputPower = new QSpinBox();
	pQSpinBoxOutputPower->setRange(-100, 0);
	m_nOutputPower = pQObjAppProp->getOutputPower();
	pQSpinBoxOutputPower->setValue(m_nOutputPower);
	connect(pQSpinBoxOutputPower, SIGNAL(valueChanged(int)), SLOT(setOutputPower(int)));  

	QLabel *pQLabelSensitivity = new QLabel(tr("Sensitivity, (dBm):"));
	QSpinBox *pQSpinBoxSensitivity = new QSpinBox();
	pQSpinBoxSensitivity->setRange(-100, 0);
	m_nSensitivity = pQObjAppProp->getSensitivity();
	pQSpinBoxSensitivity->setValue(m_nSensitivity);
	connect(pQSpinBoxSensitivity, SIGNAL(valueChanged(int)), SLOT(setSensitivity(int)));  

	QGridLayout *pQGridLayoutTransceiver = new QGridLayout();
	pQGridLayoutTransceiver->addWidget(pQLabelOutputPower, 0, 0);
	pQGridLayoutTransceiver->addWidget(pQSpinBoxOutputPower, 0, 1);
	pQGridLayoutTransceiver->addWidget(pQLabelSensitivity, 1, 0);
	pQGridLayoutTransceiver->addWidget(pQSpinBoxSensitivity, 1, 1);

	pQGroupBoxTransceiver->setLayout(pQGridLayoutTransceiver);

	QVBoxLayout *pQVBoxLayoutMain = new QVBoxLayout();
	pQVBoxLayoutMain->addWidget(pQGroupBoxTransceiver);
	setLayout(pQVBoxLayoutMain);
	
}
/****************************************************************************
/* End of file																*
****************************************************************************/
